<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>百慧智慧wms仓库</title>
  <link href="../layui/css/layui.css" rel="stylesheet">
</head>
<body>

	<div class="layui-fluid">

        <form class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-block">
                    <input type="text" name="title"  placeholder="用户昵称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-block">
                    <input type="text" name="start"  placeholder="开始时间" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-block">
                    <input type="text" name="end"  placeholder="结束时间" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-primary layui-border-blue  layui-btn-sm" lay-submit lay-filter="search">
                     <i class="layui-icon layui-icon-search"></i>     搜索
                    </button>
                    <button type="reset" class="layui-btn layui-btn-primary layui-border-red  layui-btn-sm">
                        <i class="layui-icon layui-icon-refresh-3"></i>    重置
                    </button>
                </div>
            </div>
        </form>

        <!-- 数据表格 -->
        <table id="demo" lay-filter="test"></table>
    </div>


<script src="../layui/layui.js"></script>
<script>

    layui.use(["table"],function() {
        const table = layui.table;



        table.render({
            elem:"#demo",
            url:"/getLogs",
            page:{
                prev:'上一页',
                next:'下一页'
            },
            where:{
                type:1
            },
            limit:5,
            limits:[5,10,15,20,25],
            request:{
                pageName: 'pageNo',
                limitName:'pageSize'
            },
            parseData:function(res){
                return {
                    "code": res.code,
                    "msg": res.msg,
                    "count": res.obj.count,
                    "data": res.obj.data
                }
            },
            cols:[
                [
                    {
                        title: '序号',
                        type:'numbers',
                    },
                    {
                        field: 'nickName',
                        title: '昵称',
                        sort: true
                    },
                    {
                        field: 'ipAddr',
                        title: '登录地址',
                        sort: true
                    },
                    {
                        field: 'methodName',
                        title: '请求方法',
                        templet:function (d) {
                            return '<span class="layui-badge layui-bg-green">'+d.methodName+'</span>';
                        }
                    },
                    {
                        field: 'method',
                        title: '请求方式',
                        templet:function (d) {
                            return '<span class="layui-badge layui-bg-black">'+d.method+'</span>';
                        }
                    },
                    {
                        field: 'type',
                        title: '日志类型',
                        templet:function (d) {
                            return d.type==0?'<span class="layui-badge layui-bg-blue">系统日志</span>':'<span class="layui-badge">登录日志</span>';
                        }
                    },
                    {
                        field: 'createTime',
                        title: '创建时间',
                        sort: true
                    }
                ]
            ]
        });

    });

</script>
</body>
</html>